<?php
class TeamRankingsController extends AppController {

	var $name = 'TeamRankings';
	var $paginate =	array(
		'order' => array(
			'TeamRanking.iGroup' => 'asc',
			'TeamRanking.iRanking' => 'asc'),
		'contain' => array(
			'Team' => array(
				'Coach',
					'Race' => array ('LocalizedString')
		)),
		'limit' =>32,
	);

	function index() {
		if (!$this->championship) {
			$this->Session->setFlash(__('You must select a championship', true));
			$this->set('noview', true);
			return;
		}

		$this->set('noview', false);

		$teamRankings = $this->paginate('TeamRanking', array(
			'TeamRanking.idRule_Listing' => $this->championship
		));
		if (isset($this->params['requested'])) {
			return $teamRankings;
		} else {
			$this->set('teamRankings', $teamRankings);
		}
	}
}
?>